feat(rs274ngc): MAX_UNWIND_TURNS auto rotary G0 rebase#3990
Conversation
4684b5d to
54db0fe
Compare
54db0fe to
219c501
Compare
|
@djdelorie did you have time to check this is what you wanted? |
|
I haven't, but amusingly, I was just doing a helical carve this morning. I'll bump up its priority. |
|
So I had time to do a bit of testing today, and noticed some (expected?) weird display results with G0 A where was NOT zero. Example: home A g1 a3630 home A again I think that having the display and the internal coordinates (#<_a>) not matching is going to be too confusing to use, but the motion bug is a real bug - it would have cut the wrong path. (this was all with the WCS A offsets set to zero) Also, a G0A0 followed by a home-A then G1A0 did a full unwind. |
|
what did you set [AXIS_A] MAX_UNWIND_TURNS to? |
|
are you using axis UI? |
|
are you ok if I were to leverage G92? like set G92 automatically? because we are basically recreating it just for this scope. |
|
10, Axis UI, and I think it would make more sense to tweak the G59 (or current WCS) offsets than the G92 ones, because that's what everyone ends up doing with the G10 L20 trick anyway. |
219c501 to
bf7aa25
Compare
|
@djdelorie I reworked this to ride the G92 offset instead of a private interp offset. Two things change for the better:
On your suggestion to use the WCS (G10 L20) offset instead of G92: I kept it on G92 deliberately. The unwind is a machine-frame fact that has to survive WCS switches, and G92 is the single offset applied on top of whatever WCS is active, whereas a G5x offset is per-WCS and would be dropped by a A few notes on the approach:
Rebased on current master and pushed. Could you retest your helical-carve cases, especially the home/abort sequences that gave the wrong path before? Thanks. |
4a75185 to
a49fda0
Compare
Add [AXIS_<L>] MAX_UNWIND_TURNS = N. On a G0 absolute move with the rotary word, if the programmed (work-frame) delta exceeds N full turns, fold the whole turns into the axis (G92) offset so the motor takes the shortest path (within +/- 180 deg) to the target's angular position while the work-frame position still reaches the commanded target. The motion-side accumulated position is unchanged, so stepgens, encoders and PID see no discontinuity. Riding the existing G92 plumbing means the DRO, #<_a> and #5423 all report the programmed value with no special-casing; the accumulated turns appear as a G92 offset (#5214-#5216). On re-home or estop reset the interpreter resynchronizes and detects the frame re-anchor (a >180 deg work-frame jump on a managed axis with a live offset); it collapses the stale offset back into the work frame and re-emits the G92 so canon agrees, so a fresh home starts clean. Gated to trivkins 1:1 axis-to-joint mapping; coupled kinematics (5-axis TCP, gantry rotary) unsupported. Mutually exclusive with WRAPPED_ROTARY (startup warning if both set on the same axis). Default 0 (disabled).
a49fda0 to
114f1b1
Compare
Draft for testing and feedback. Targets the rotational-cutting use case from #3902 where G1 must honor literal multi-turn absolute targets (helical winding, spiral carving) but a terminal G0 should not physically unwind.
Mechanism
New INI flag
[AXIS_<L>] MAX_UNWIND_TURNS = N. On a G0 absolute move with the rotary word, if the user-frame delta exceeds N full turns, the interpreter shifts a per-axis hidden user-frame offset so the motor stays put while the user-frame position jumps to the programmed target. Subsequent absolute moves use the rebased frame.The motion-side
traj.positionremains accumulated. Only an interp-only offset moves. Stepgens, encoders, and PID see no discontinuity, sidestepping themotor_offsetinjection problem @andypugh raised in #3902. G53 explicitly bypasses (literal machine coords). Incremental (G91) is unaffected.Trace
#5423/#5424/#5425and_a/_b/_cnamed params report user-frame.Trade-offs / caveats
MAX_LIMITeventually reached on very long runs. Trade is necessary because in-program joint rebase is not safely doable (per @andypugh's analysis).WRAPPED_ROTARY, startup warning if both set.Mapping to other controls
Closest precedent is Hurco M31 (explicit, programmer-placed). This implementation auto-triggers on G0 above a threshold; to my knowledge no commercial control automates this but the structural reasons (mostly TCP coupling) are addressable via the trivkins gate.
Status
Draft, seeking feedback and test results from @djdelorie's helical-carving setup before promoting. Build clean.